Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REF] Remove always false if #20653

Merged
merged 1 commit into from
Jun 18, 2021

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Jun 18, 2021

Overview

[REF] Remove always false if

Before

recordFinancialAccounts checks is line items is empty - but it never is due to these lines

After

The check for empty is removed, the code is moved into the if that would make it possibly true.

Technical Details

We recently added code to ensure line_item is always populated
before this function is called

// Get Line Items if we don't have them already.
if (empty($params['line_item'])) {
CRM_Price_BAO_LineItem::getLineItemArray($params, $contributionID ? [$contributionID] : NULL);
}

(it is only called from one place in core which is a few lines further down)

So line items is never empty at this point

Comments

There is more cleanup that can follow on from this - ie removing more unused stuff - but I wanted to keep this easy to review

We recently added code to ensure line_item is always populated
before this function is called. So line items is never empty at this point
@civibot
Copy link

civibot bot commented Jun 18, 2021

(Standard links)

@civibot civibot bot added the master label Jun 18, 2021
@@ -3415,11 +3419,6 @@ public static function recordFinancialAccounts(&$params, $financialTrxnValues =

$statusId = $params['contribution']->contribution_status_id;

// build line item array if its not set in $params
if (empty($params['line_item']) || $additionalParticipantId) {
CRM_Price_BAO_LineItem::getLineItemArray($params, $entityID, str_replace('civicrm_', '', $entityTable), $isRelatedId);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isRelatedId also removed as that is only set for memberships

@seamuslee001 seamuslee001 merged commit 3bb9adf into civicrm:master Jun 18, 2021
@seamuslee001 seamuslee001 deleted the you_have_lines branch June 18, 2021 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants